'use strict';

describe 'filters', ()->
  beforeEach(module('UCX.Cmis'))
  $filter = null
  beforeEach(inject (_$filter_)->
    $filter = _$filter_
  )
  it 'test bytes', ()->
    bytes = $filter('bytes')

    expect(bytes(10000)).toEqual('9.8 KB')
    expect(bytes(10000,2)).toEqual('9.77 KB')
    expect(bytes(1024*1024,2)).toEqual('1.00 MB')


  it 'test nl2br', ()->
    filter = $filter('nl2br')
    expect(filter('dd').$$unwrapTrustedValue()).toEqual('dd')
    expect(filter('aa\ndd').$$unwrapTrustedValue()).toEqual('aa<br />dd')

  it 'test LevelFilter', ()->
    filter = $filter('LevelFilter')
    expect(filter('private')).toEqual('Private')
    expect(filter('confidential')).toEqual('Confidential')
    expect(filter('classified')).toEqual('Classified')
    expect(filter('topsecret')).toEqual('Topsecret')